import { defineStore } from 'pinia'

import { getMenuList } from '@/api/menus'

export const useMenuStore = defineStore('menu', {
  state: () => ({
    menuList: []
  }),

  actions: {
    async GET_MENU_LIST() {
      const {
        data: {
          data,
          meta: { status }
        }
      } = await getMenuList()
      if (status !== 200) return false
      this.menuList = data
      console.log(this.menuList)

      return true
    }
  },
  persist: true
})
